<?php
/**
 * Created by PhpStorm.
 * User: bzyy
 * Date: 2015/7/4
 * Time: 14:57
 *
 * 仅仅是为了把数据库中的商品，放到redis中，是初始化redis数据的一个操作
 *
 */

require_once './class/defind.php';
require_once './class/class_mysql.php';
require_once './class/redis.php';
require_once './class/bzyy.php';

$mysql = init_mysql();

$sql = "select * from goods ";

$data = $mysql->getAll($sql);


$redis = init_redis();

foreach($data as $val)
{
    $store = $val['store'];
    unset($val['store']);

    //保存商品信息
    $f = $redis->set("goods_info_{$val['id']}",json_encode($val));

    //保存商品数量
    $redis->set("goods_id:{$val['id']}",$store);
}








